home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / gofer221.zip / GOFER.EL < prev    next >
Lisp/Scheme  |  1991-11-20  |  2KB  |  54 lines

  1. ;;; Gofer mode for GNU Emacs
  2. ;;;
  3. ;;; Last update: 29/10/91
  4. ;;;
  5. ;;; Author: Stuart Clayman,
  6. ;;;         Dept. Computer Science,
  7. ;;;         University College London
  8. ;;;
  9. ;;; Email: sclayman@uk.ac.ucl.cs
  10. ;;;
  11. ;;;
  12. ;;; In the file .emacs put a line 
  13. ;;; (autoload 'run-gofer "gofer" "Run gofer as inferior process" t) 
  14. ;;; 
  15. ;;; In emacs type ESC-x run-gofer
  16. ;;; In files that are gofer source type ESC-x gofer-mode
  17. ;;; 
  18. ;;; To get the files to load into gofer type ESC C-x
  19. ;;; 
  20.  
  21. (require 'shell)
  22.  
  23. (defvar gofer-mode-hook nil "Gofer mode hook")
  24.  
  25. (defun run-gofer()
  26.   "Run an inferior Gofer process."
  27.   (interactive)
  28.   (switch-to-buffer (make-shell "gofer" "gofer"))
  29.   (make-variable-buffer-local 'shell-prompt-pattern)
  30.   (setq shell-prompt-pattern "^[? ]*? \\|^"))
  31.  
  32. (defun save-gofer-buffer-and-go(arg)
  33.   "Save current Gofer file buffer.
  34. Goto inferior Gofer buffer and load file.
  35. With ARG make additional file"
  36.   (interactive "P")
  37.   (save-buffer)
  38.   (if (or (null (get-buffer "*gofer*")) (null (process-status "gofer")))  ; if gofer not running
  39.       (save-excursion (run-gofer)))     ; run it
  40.   (if arg
  41.       (send-string "gofer" (concat ":a " (buffer-name) "\n")))
  42.   (send-string "gofer" (concat ":l " (buffer-name) "\n"))
  43.   (switch-to-buffer-other-window "*gofer*"))
  44.  
  45. (defun gofer-mode()
  46.   "Gofer mode."
  47.   (interactive)
  48.   (setq mode-name "Gofer")
  49.   (make-variable-buffer-local 'indent-line-function)
  50.   (setq indent-line-function 'indent-relative)
  51.   (run-hooks 'gofer-mode-hook)
  52.   (local-set-key "\e\C-x" 'save-gofer-buffer-and-go)
  53.   (local-set-key "\eg" 'goto-line))
  54.